Sometimes, we can have a problem in which we need to construct a new container with elements from different containers. This kind of problem can occur in domains in which we use different types of data. Let’s discuss ways to convert string and list data to tuple....
Sometimes, while working with Python lists, we can have a problem or part of it, in which we desire to convert a list after deletion of some random element. This can have it’s application in gaming domain or personal projects. Let’s discuss certain way in which this task can be done....
Sometimes, while working with Python dictionaries, we might come across a problem in which we need to find if a particular key of the dictionary is valid i.e it is not False or has a non-none value. This kind of problem can occur in the Machine Learning domain. Let’s discuss certain ways in which this problem can be solved....
Sometimes, while working with dictionaries, we might have a utility problem in which we need to perform elementary operations among the common keys of dictionaries in Python. This can be extended to any operation to be performed. Let’s discuss the subtraction of like key values and ways to solve it in this article....
Given two list of dictionaries, the task is to merge these two lists of dictionaries based on some value....
Given a Roman numeral, the task is to find its corresponding decimal value....
Python doesn’t provide any inbuilt method to easily convert floating point decimal numbers to binary number. So, Let’s do this manually. Approach : To convert a floating point decimal number into binary, first convert the integer part into binary form and then fractional part into binary form and finally combine both results to get the final answer. For Integer Part, keep dividing the number by 2 and noting down the remainder until and unless the dividend is less than 2. If so, stop and copy all the remainders together. For Decimal Part, keep multiplying the decimal part with 2 until and unless 0 left as fractional part. After multiplying the first time, note down integral part and again multiply decimal part of the new value by 2. Keep doing this until reached a perfect number....
Given a date list and date range, the task is to write a Python program to check whether any date exists in the list in a given range....
The task of removing duplicates many times in the recent past, but sometimes when we deal with the complex data structure, in those cases we need different techniques to handle this type of problem. Let’s discuss certain ways in which this task can be achieved....
Given List of Strings, escape reserved characters in each String....
Sometimes, while working with lists, we can have a problem in which we need to group all the sublists, separated by elements present in different list. This type of custom grouping is uncommon utility but having solution to these can always be handy. Lets discuss certain way in which this task can be performed. Method #1 : Using loop + generator(yield) This is brute force way in which this task can be performed. In this, we iterate the list and make groups dynamically using yield. We keep track of elements occurred and restart list when we find element in second list....
In this article, we will learn how to create a Python script to read the latest news. We will fetch news from news API and after that, we will read news using pyttsx3....